define(['angular', 'app', 'ngUiRouter', 'app.services','services/common/base'], function (angular, app,service) {

    'use strict';

    app.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {

        app.loadJs = function(js){
            return function($rootScope, $q){
                var def = $q.defer(), deps=[];
                angular.isArray(js) ? (deps = js) : deps.push(js);
                require(deps,function(){
                    $rootScope.$apply(function(){
                        def.resolve();
                    });
                });
                return def.promise;
            };
        }

        $urlRouterProvider.otherwise(function(){
            return "/vs/lt"
        });
        /**
         * 基础路由
         */
        $stateProvider.state("vs", {
            url: "/vs",
            resolve: {
                deps:app.loadJs(['directives/vs/vs'])
            },
            templateUrl: "/app/partial/vs/vs.html"
        });
        $stateProvider.state("vs.lt", {//时间控制页面
            url: "/lt",
            template: "<long-time></long-time>"
        })
        $stateProvider.state("vs.vw", {//版本控制页面
            url: "/vw",
            template: "<version-war></version-war>"
        })
    }]);
});